From: Jasper St. Pierre Date: Tue, 18 Jun 2013 08:46:44 +0000 (-0400) Subject: popupMenu: Introduce a way of closing toplevels from sections X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~3945 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7db0900cc86049578315e80eb104e300fba8fcdc;p=gnome-shell.git popupMenu: Introduce a way of closing toplevels from sections As the aggregate menu will be built out of sections from each of the menus, we need to ensure that activating an item in one of these sections can close the main menu, even when it is not a menu item. The new API also needs to be flexible enough to ensure that animations can be controlled, like the buttons that lock the screen or launch a new session. Port the user menu to use this new API as well. https://bugzilla.gnome.org/show_bug.cgi?id=702539 --- diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js index b0d219f5a..b5b156db6 100644 --- a/js/ui/popupMenu.js +++ b/js/ui/popupMenu.js @@ -754,6 +754,13 @@ const PopupMenuBase = new Lang.Class({ return false; }, + itemActivated: function(animate) { + if (animate == undefined) + animate = BoxPointer.PopupAnimation.FULL; + + this._getTopMenu().close(animate); + }, + /** * _connectSubMenuSignals: * @object: a menu item, or a menu section @@ -800,7 +807,7 @@ const PopupMenuBase = new Lang.Class({ })); menuItem._activateId = menuItem.connect('activate', Lang.bind(this, function (menuItem, event) { this.emit('activate', menuItem); - this.close(BoxPointer.PopupAnimation.FULL); + this.itemActivated(BoxPointer.PopupAnimation.FULL); })); // the weird name is to avoid a conflict with some random property // the menuItem may have, called destroyId diff --git a/js/ui/userMenu.js b/js/ui/userMenu.js index 86980c5a6..68a300a4d 100644 --- a/js/ui/userMenu.js +++ b/js/ui/userMenu.js @@ -803,13 +803,13 @@ const UserMenuButton = new Lang.Class({ }, _onLockScreenActivate: function() { - this.menu.close(BoxPointer.PopupAnimation.NONE); + this.menu.itemActivated(BoxPointer.PopupAnimation.NONE); Main.overview.hide(); Main.screenShield.lock(true); }, _onLoginScreenActivate: function() { - this.menu.close(BoxPointer.PopupAnimation.NONE); + this.menu.itemActivated(BoxPointer.PopupAnimation.NONE); Main.overview.hide(); if (Main.screenShield) Main.screenShield.lock(false); @@ -937,7 +937,7 @@ const UserMenuButton = new Lang.Class({ this._session.ShutdownRemote(); })); } else { - this.menu.close(BoxPointer.PopupAnimation.NONE); + this.menu.itemActivated(BoxPointer.PopupAnimation.NONE); this._loginManager.suspend(); } }